<?php
/**
 * Created by PhpStorm.
 * User: HS032
 * Date: 2020/8/25
 * Time: 9:13
 */

namespace ticket\modules\frontend\controllers;

use ticket\libs\Tools;
use Yii;
use yii\base\Exception;
use yii\log\FileTarget;
use yii\web\Controller;
use ticket\modules\frontend\models\PointsLog;

class PointController extends BasicController
{

    /* 记录点位数据
    1-首页 2-首页门票 3-门票升级访问 4-年卡升级访问 5-门票升级二维码 6-年卡升级购买
     */
    public function actionAddPointLog()
    {
        if  (Yii::$app->request->isPost){
            $post = Yii::$app->request->post();
            $appid= isset($post['appid'])?$post['appid']:'';
            $member_id= isset($post['member_id'])?$post['member_id']:'';
            $type= isset($post['type'])?$post['type']:1;
            $point_id =  isset($post['point_id'])?$post['point_id']:1;

            $model = New PointsLog();
            $model->appid = $appid;
            $model->member_id = $member_id;
            $model->type = $type;
            $model->point_id = $point_id;

            $model->create_time = date('Y-m-d H:i:s');
            if($model->save()){
                return Tools::showRes(0,'记录成功');
            }else{
                return Tools::showRes(400,'记录失败');
            }
        }
    }





    

}